<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:r="http://ricchieri.com/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="../../templates/commonLayoutOther.xhtml">
		<ui:define name="title">#{msg.titleOther}</ui:define>
		<ui:define name="content">
			<h:form id="viewEmailStatus">
				<p:messages showDetail="false" autoUpdate="true" closable="false"/>
	     		<h2>#{msg.searchEmailStatus}</h2> 
		     	<h:panelGrid columns="2">
		     		<h:panelGrid columns="2">
			     		<h:outputLabel for="firstName" value="#{msg.first_name}" />
			     		<p:inputText id="firstName" value="#{viewEmailToSendMB.emailToSendFilter.firstName}"/>
			     		
			     		<h:outputLabel for="lastName" value="#{msg.last_name}" />  
					    <p:inputText id="lastName" value="#{viewEmailToSendMB.emailToSendFilter.lastName}" />
			            
			            <h:outputLabel for="documentType" value="#{msg.documentType}"/>
			     		<p:selectOneMenu id="documentType" value="#{viewEmailToSendMB.emailToSendFilter.documentType}">
			     			<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
			                <f:selectItems value="#{viewEmailToSendMB.documentType}" />   
			            </p:selectOneMenu> 
			            
			     		<h:outputLabel for="dni" value="#{msg.documentNum}" />
					    <p:inputText id="dni" value="#{viewEmailToSendMB.emailToSendFilter.dni}" onkeypress="if(event.which &lt; 48 || event.which &gt; 57) return false;"/>
					</h:panelGrid> 
					<h:panelGrid columns="2">
						<h:outputLabel value="#{msg.from}" />
						<p:calendar pattern="dd/MM/yyyy" showOn="button"
							readOnlyInputText="true"
							value="#{viewEmailToSendMB.emailToSendFilter.start}">
							<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
						</p:calendar>
						
						<h:outputLabel value="#{msg.to}" />
						<p:calendar pattern="dd/MM/yyyy" showOn="button"
							readOnlyInputText="true"
							value="#{viewEmailToSendMB.emailToSendFilter.finish}">
							<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
						</p:calendar>
						
					    <h:outputLabel for="emailToSendType" value="#{msg.emailToSendType}"/>
			     		<p:selectOneMenu id="emailToSendType" value="#{viewEmailToSendMB.emailToSendFilter.emailToSendType}">
			     			<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
			                <f:selectItems value="#{viewEmailToSendMB.emailToSendType}" />   
			            </p:selectOneMenu> 
					</h:panelGrid>   
				</h:panelGrid>
				<h:panelGrid columns="2" style="margin-top:10px; text-align:center">
	     			<r:commandLinkCustom id="reset" action="#{viewEmailToSendMB}" method="reset" icon="icon-eraser" message="#{msg.resetButton}"/>
     				<r:commandLinkCustom id="search" action="#{viewEmailToSendMB}" method="search" icon="icon-search" message="#{msg.searchButton}"/>
	     	 	</h:panelGrid>
	     	 	
	     	 	<p:blockUI block="emailToSendTable" trigger="emailToSendTable">  
			        #{msg.loading}<br />  
			        <p:graphicImage value="/images/ajax-loader.gif"/>  
			    </p:blockUI>
	     	 	<p:dataTable var="emailToSend" value="#{viewEmailToSendMB.emailToSendLazyDataModel}" 
	     	 		style="padding-top:15px" paginator="true" lazy="true" id="emailToSendTable"
	     	 		rows="10"
	     	 		paginatorPosition="bottom" emptyMessage="#{msg.noRecordsFound}">
	 
	 				<p:column headerText="#{msg.fullname}" style="width:7%"> 
	 					<h:outputText value="#{emailToSend.user.fullName}" />
	 				</p:column>
	 				
	        		<p:column headerText="#{msg.documentType}" style="width:7%"> 
	 					<h:outputText value="#{viewEmailToSendMB.obtainDescription(emailToSend.user.documentType.description)}" />
	 				</p:column>
	 				
	 				<p:column headerText="#{msg.documentNum}" style="width:7%"> 
	 					<h:outputText value="#{emailToSend.user.dni}" />
	 				</p:column>
	 				
	 				<p:column headerText="#{msg.sendDate}" style="width:7%"> 
	 					<h:outputText value="#{viewEmailToSendMB.formatDate(emailToSend.sendDate)}" />
	 				</p:column>
	 				
	 				<p:column headerText="#{msg.emailToSendType}" style="width:7%"> 
	 					<h:outputText value="#{viewEmailToSendMB.obtainDescription(emailToSend.emailToSendType.description)}" />
	 				</p:column>	  
	 				
	 				<p:column style="width:7%">
	        			<center>
	        				<p:commandButton value="#{msg.resend}" update="@form" action="#{viewEmailToSendMB.resendEmail(emailToSend)}"/>
	        			</center>
	        		</p:column>     		
	        	</p:dataTable>
				</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>
